package com.example.demo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.example.demo.dto.SearchInfo;
import com.example.demo.entity.Check;



@Repository()
public interface Check_Mapper extends BaseMapper<Check>{
	
	@Select("select `check`.*,patient.name patient_name "
			+ " from `check` inner join patient on `check`.patient_id=patient.id   ${where} ${limitstr}")
	public List<Check> select(SearchInfo info);
	@Select("select count(1) from `check` inner join patient on `check`.patient_id=patient.id   ${where} ")
	public long selectCount(SearchInfo info);
	
	@Insert("insert into `check` (patient_id,test_date,test_result) values(#{patient_id},#{test_date},#{test_result})")
	public void insert (Check d);
	
	@Update("update `check` set patient_id=#{patient_id},test_date=#{test_date},test_result=#{test_result} where id=#{id}")
	public void update (Check d);
	
	
	@Select("delete from `check` where id=#{id}")
	public void delete(int id);
	
	@Select("select * from `check` where id=#{id} ")
	public Check selectById(int id);
	
}